import request from "../service/axios";
import { useRoute } from "vue-router";
const route = useRoute();
const id = "64cdb9d70955521ecff602cc";

// 批注列表
export const getMediasAnnotationsList = async (params: any) => {
    const res = await request({
        url: `/mediaresource-manage-service/medias/${params.id}/annotations`,
        method: "get",
        params: params,
    });
    return res.data.result.data;
};

// 新增批注
export const addMediasAnnotationsList = async (obj: any) => {
    let id = obj.id;
    let postObj = obj;
    delete postObj.id;
    const res = await request({
        url: `/mediaresource-manage-service/medias/${id}/annotations`,
        method: "post",
        data: postObj,
    });
    return res.data.result.data;
};

// 转码模块--------------------------------------------------------------------------------
// 媒资转码列表
export const subsetVideoTrans = async (params: any) => {
    const res = await request({
        url: `/mediaresourcelib-common-cms/subset/video_trans`,
        method: "post",
        data: params,
    });
    return res.data.result.data;
};
// 音频参数
export const getConfig = async () => {
    const res = await request({
        url: `/mediaresourcelib-media-transform/main/getConfig`,
        method: "post",
    });
    return res.data.result.data;
};
// 视频转码
export const videoTrans = async (obj: any) => {
    console.log(obj);

    const res = await request({
        url: `/mediaresourcelib-media-transform/main/video_trans`,
        method: "post",
        data: obj,
    });
    return res.data.result.data;
};
// 音频编码
export const audioTrans = async (obj: any) => {
    console.log(obj);

    const res = await request({
        url: `/mediaresourcelib-media-transform/main/audio_trans`,
        method: "post",
        data: obj,
    });
    return res.data.result.data;
};

// 标签模块接口--------------------------------------------------------------------------------
export const sensitiveLibraryCheck = async (params: any) => {
    const res = await request({
        url: `/mediaresourcelib-base-lib/sensitive/library/check`,
        method: "post",
        data:params
    });
    return res.data.result.data;
    // return Promise.resolve([])
};
// 获取标签里面媒资信息
export const getAssociation = async (params: any) => {
    const res = await request({
        url: `/mediaresource-manage-service/medias/${params.id}/association`,
        method: "get",
    });
    return res.data.result?.data || [];
};
// 获取审批状态详情
export const getApprove = async (params: any) => {
    const res = await request({
        url: `/workflow/mediaInfo/getApprove/${params.id}`,
        method: "get",
    });
    return res.data.result.data;
};

// 获取审批状态
export const getProcess = async (params: any) => {
    const res = await request({
        url: `/workflow/mediaInfo/getProcess/${params.id}`,
        method: "get",
    });
    return res.data.result.data;
};

// 送审提交
export const mediaInfoPost = async (params: any) => {
    const res = await request({
        url: `/workflow/mediaInfo/post`,
        method: "post",
        data: params,
    });
    return res.data.result.data;
};

// 标注栏目
export const initColumn = async () => {
    const res = await request({
        url: `/mediaresourcelib-base-lib/column/selection`,
        method: "get",
    });
    return res.data.result.data;
};
// 标注栏目 改
export const initColumnCase = async () => {
    const res = await request({
        url: `/mediaresourcelib-base-lib/column/select`,
        method: "get",
    });
    return res.data.result.data;
};
// 关联专题弹框里面的分类列表
export const initColumnSubject= async (params:any) => {
    const res = await request({
        url: `/mediaresourcelib-base-lib/subject`,
        method: "get",
        params
    });
    return res.data.result.data;
};
// 获取来源下拉
export const initSource = async () => {
    const res = await request({
        url: `/mediaresourcelib-base-lib/source/selection`,
        method: "get",
    });
    return res.data.result.data;
};

// 获取机审详情
export const getResultDetail = async (id: string) => {
    const res = await request({
        url: `/mediaresourcelib-aiaudit-service/contentreview/getResult/${id}`,
        method: "get",
    });
    return res.data.result.data;
};

// 修改媒资加锁
export const mediaInfoLock = (data: any) => {
    return request({
        url: `/workflow/mediaInfo/lock/${data.id}`,
    });
};

// 媒资来源
export const sourceMedia = () => {
    return request({
        method: "get",
        url: "/mediaresourcelib-base-lib/source/selection",
    });
};
